home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 5579 / 5579.xpi / chrome / content / photography.xslt < prev    next >
Extensible Markup Language  |  2010-01-06  |  15KB  |  379 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:transform version="1.0"
  3.                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  4.                xmlns:atom="http://www.w3.org/2005/Atom"
  5.                xmlns:gd="http://schemas.google.com/g/2005"
  6.                xmlns:gphoto="http://schemas.google.com/photos/2007"
  7.                xmlns:exif="http://schemas.google.com/photos/exif/2007"
  8.                xmlns:media="http://search.yahoo.com/mrss/"
  9.                xmlns:mediabroken="http://search.yahoo.com/mrss"
  10.                xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  11.                xmlns:html="http://www.w3.org/1999/xhtml"
  12.                xmlns:ci="http://schemas.cooliris.com/layout/2008">
  13.  
  14.   <xsl:output method="xml" encoding="utf-8" indent="yes"/>
  15.  
  16.   <xsl:include href="resource:theme-dark.xslt"/>
  17.   <xsl:include href="resource:common.xslt"/>
  18.  
  19.  
  20.   <xsl:param name="iso-image">resource:images/icon.iso.png</xsl:param>
  21.   <xsl:param name="flash-on-image">resource:images/icon.flash.png</xsl:param>
  22.  
  23.  
  24.   <xsl:param name="ci:com.cooliris.local-mode"/>
  25.   <xsl:param name="ci:com.cooliris.feed.empty"/>
  26.  
  27.  
  28.   <xsl:template match="/ci:feedData">
  29.     <xsl:if test="$ci:com.cooliris.local-mode = 'true' and $ci:com.cooliris.feed.empty = 'true'">
  30.       <ci:layoutSet>
  31.         <xul:window id="foreground" style="{$standard-font}">
  32.           <xul:vbox>
  33.             <xul:box flex="1"/>
  34.             <xul:box flex="1" align="middle" pack="middle">
  35.               <xsl:call-template name="message-box">
  36.                 <xsl:with-param name="title"><xsl:value-of select="$string-no-images-title"/></xsl:with-param>
  37.                 <xsl:with-param name="description"><xsl:value-of select="$string-no-images-description"/></xsl:with-param>
  38.               </xsl:call-template>
  39.             </xul:box>
  40.             <xul:box flex="2"/>
  41.           </xul:vbox>
  42.         </xul:window>
  43.       </ci:layoutSet>
  44.     </xsl:if>
  45.   </xsl:template>
  46.  
  47.  
  48.   <xsl:template match="item[@ci:state='placeholder']">
  49.     <xsl:call-template name="standard-loading-window"/>
  50.   </xsl:template>
  51.  
  52.  
  53.   <xsl:template match="item[@ci:state='thumbnail']">
  54.     <xsl:call-template name="thumbnail-window-image-only"/>
  55.   </xsl:template>
  56.  
  57.  
  58.   <xsl:template match="item[@ci:state='thumbnail-hover']">
  59.     <xsl:variable name="title">
  60.       <xsl:choose>
  61.         <xsl:when test="gphoto:albumtitle"><xsl:value-of select="gphoto:albumtitle/text()"/></xsl:when>
  62.         <xsl:when test="title"><xsl:value-of select="title/text()"/></xsl:when>
  63.       </xsl:choose>
  64.     </xsl:variable>
  65.  
  66.     <xsl:call-template name="thumbnail-window-with-overlay">
  67.       <xsl:with-param name="bottom-overlay">
  68.         <xsl:if test="link[@rel='album'] or $title">
  69.           <xul:hbox>
  70.             <xsl:attribute name="style">
  71.               <xsl:value-of select="$shaded-background"/>
  72.             </xsl:attribute>
  73.  
  74.             <xsl:if test="link[@rel='album']">
  75.               <xul:vbox style="-ci-align:override: end;" pack="end">
  76.                 <xul:box height="4pt"/>
  77.                 <ci:button id="badge" style="max-height: 48px">
  78.                   <xsl:attribute name="src"><xsl:value-of select="$album-badge-uri"/></xsl:attribute>
  79.                   <xsl:attribute name="href">
  80.                     <xsl:value-of select="link[@rel='album']/@href"/>
  81.                   </xsl:attribute>
  82.                   <xsl:attribute name="alt">
  83.                     <xsl:value-of select="$string-goto-album"/>
  84.                   </xsl:attribute>
  85.                 </ci:button>
  86.               </xul:vbox>
  87.             </xsl:if>
  88.  
  89.             <xsl:if test="$title">
  90.               <xul:description id="title" flex="1">
  91.                 <xsl:attribute name="style">
  92.                   padding: 4pt;
  93.                   font-size: 11pt;
  94.                   line-height: 110%;
  95.                   max-height: 4em;
  96.                   -ci-text-truncate-mode: ellipsis;
  97.                   -ci-text-box-expand: true;
  98.                 </xsl:attribute>
  99.                 <xsl:value-of select="$title"/>
  100.               </xul:description>
  101.             </xsl:if>
  102.            </xul:hbox>
  103.          </xsl:if>
  104.       </xsl:with-param>
  105.     </xsl:call-template>
  106.   </xsl:template>
  107.  
  108.   <!-- TODO: media:keywords copyright creation-date -->
  109.  
  110.   <xsl:template name="metadata-panel">
  111.     <xsl:variable name="local-file-p" select="starts-with(link/text(), 'file')"/>
  112.  
  113.     <xsl:variable name="title">
  114.       <xsl:call-template name="get-title"/>
  115.     </xsl:variable>
  116.  
  117.     <xsl:variable name="description">
  118.       <xsl:call-template name="get-description"/>
  119.     </xsl:variable>
  120.  
  121.     <xul:stack>
  122.       <xul:vbox align="end">
  123.         <xul:hbox id="button-box" style="-ci-occlusion-group-id: right-side-metadata">
  124.           <xul:box width="{$large-separator}"/>
  125.           <xsl:choose>
  126.             <xsl:when test="$local-file-p">
  127.               <xsl:call-template name="goto-folder-button"/>
  128.             </xsl:when>
  129.             <xsl:otherwise>
  130.               <xsl:call-template name="share-button"/>
  131.               <xsl:call-template name="favorite-button"/>
  132.               <xsl:call-template name="goto-uri-button"/>
  133.             </xsl:otherwise>
  134.           </xsl:choose>
  135.         </xul:hbox>
  136.       </xul:vbox>
  137.  
  138.       <xul:vbox>
  139.         <xul:description id="header-text">
  140.           <xsl:attribute name="style">
  141.             <xsl:choose>
  142.               <xsl:when test="@ci:state = 'selected'">
  143.                 font-size: 13pt;
  144.                 max-height: 4em;
  145.                 min-width: 200px;
  146.               </xsl:when>
  147.               <xsl:otherwise>
  148.                 font-size: 16pt;
  149.                 max-height: 10em;
  150.               </xsl:otherwise>
  151.             </xsl:choose>
  152.             color: <xsl:value-of select="bright-foreground-color"/>;
  153.             line-height: 110%;
  154.             -ci-text-box-expand: true;
  155.             -ci-text-truncate-mode: ellipsis;
  156.             -ci-occlusion-group-idref: right-side-metadata;
  157.           </xsl:attribute>
  158.  
  159.           <html:span style="color: {$highlight-foreground-color}; font-weight: bold;">
  160.             <xsl:choose>
  161.               <xsl:when test="link[@rel='album']">
  162.                 <html:a style="{$standard-link-style}">
  163.                   <xsl:attribute name="href">
  164.                     <xsl:value-of select="link[@rel='album'][position()=1]/@href"/>
  165.                   </xsl:attribute>
  166.                   <xsl:value-of select="link[@rel='album'][position()=1]/@title"/>
  167.                 </html:a>
  168.               </xsl:when>
  169.               <xsl:when test="gphoto:albumtitle">
  170.                 <xsl:value-of select="gphoto:albumtitle/text()"/>
  171.               </xsl:when>
  172.               <xsl:otherwise>
  173.                 <xsl:copy-of select="$title"/>
  174.               </xsl:otherwise>
  175.             </xsl:choose>
  176.           </html:span>
  177.  
  178.           <xsl:if test="gphoto:albumtitle and not(link[@rel='album'])">
  179.             <html:span><xsl:text> – from </xsl:text></html:span>
  180.             <html:a style="{$standard-link-style}">
  181.               <xsl:attribute name="href">
  182.                 <xsl:value-of select="link[@rel='album'][position()=1]/@href"/>
  183.               </xsl:attribute>
  184.               <xsl:value-of select="link[@rel='album'][position()=1]/@title"/>
  185.             </html:a>
  186.           </xsl:if>
  187.  
  188.           <xsl:if test="link[@rel='gallery']">
  189.             <html:span><xsl:text> by </xsl:text></html:span>
  190.             <html:a style="{$standard-link-style}">
  191.               <xsl:attribute name="href">
  192.                 <xsl:value-of select="link[@rel='gallery'][position()=1]/@href"/>
  193.               </xsl:attribute>
  194.               <xsl:value-of select="link[@rel='gallery'][position()=1]/@title"/>
  195.             </html:a>
  196.           </xsl:if>
  197.         </xul:description>
  198.  
  199.         <xsl:if test="$description">
  200.           <xul:box height="{$medium-separator}"/>
  201.           <xul:description id="description">
  202.             <xsl:attribute name="style">
  203.               line-height: 120%;
  204.               min-width: 300px;
  205.               max-height: 10em;
  206.               text-align: justify;
  207.               -ci-text-truncate-mode: ellipsis;
  208.               -ci-text-box-expand: true;
  209.               -ci-occlusion-group-idref: right-side-metadata;
  210.             </xsl:attribute>
  211.             <xsl:copy-of select="$description"/>
  212.           </xul:description>
  213.         </xsl:if>
  214.  
  215.         <xul:box height="{$medium-separator}"/>
  216.  
  217.         <xul:hbox id="footer" align="middle">
  218.           <xul:description id="footer-string" flex="100">
  219.             <xsl:attribute name="style">
  220.               line-height: 110%;
  221.               color: <xsl:value-of select="$bright-foreground-color"/>;
  222.               max-height: 4em;
  223.               -ci-text-truncate-mode: ellipsis;
  224.             </xsl:attribute>
  225.  
  226.             <xsl:if test="gd:rating">
  227.               <xsl:apply-templates select="gd:rating">
  228.                 <xsl:with-param name="baseline-height">3px</xsl:with-param>
  229.               </xsl:apply-templates>
  230.             </xsl:if>
  231.  
  232.             <xsl:if test="gphoto:width and gphoto:height">
  233.               <xsl:if test="gd:rating">
  234.                 <html:span style="color: {$dark-foreground-color}"> – </html:span>
  235.               </xsl:if>
  236.               <xsl:value-of select="gphoto:width/text()"/>├ù<xsl:value-of select="gphoto:height/text()"/>
  237.             </xsl:if>
  238.  
  239.             <xsl:if test="file-size">
  240.               <xsl:if test="gd:rating or
  241.                             gphoto:width and gphoto:height">
  242.                 <html:span style="color: {$dark-foreground-color}"> – </html:span>
  243.               </xsl:if>
  244.               <xsl:value-of select="file-size/text()"/>
  245.             </xsl:if>
  246.  
  247.             <xsl:if test="exif:tags/exif:focallength">
  248.               <xsl:if test="gd:rating or
  249.                             file-size or
  250.                             gphoto:width and gphoto:height">
  251.                 <html:span style="color: {$dark-foreground-color}"> – </html:span>
  252.               </xsl:if>
  253.               <html:span>
  254.                 <xsl:value-of select="round(number(exif:tags/exif:focallength/text()))"/>
  255.               </html:span>
  256.               <html:span> mm</html:span>
  257.             </xsl:if>
  258.  
  259.             <xsl:if test="exif:tags/exif:exposure">
  260.               <xsl:if test="gd:rating or
  261.                             file-size or
  262.                             (gphoto:width and gphoto:height) or
  263.                             exif:tags/exif:focallength">
  264.                 <html:span style="color: {$dark-foreground-color}"> – </html:span>
  265.               </xsl:if>
  266.               <html:span>
  267.                 <xsl:choose>
  268.                   <xsl:when test="number(exif:tags/exif:exposure/text()) < 1">
  269.                     <xsl:text>1/</xsl:text><xsl:value-of select="round(1.0 div number(exif:tags/exif:exposure/text()))"/>
  270.                   </xsl:when>
  271.                   <xsl:otherwise>
  272.                     <xsl:value-of select="exif:tags/exif:exposure/text()"/>
  273.                   </xsl:otherwise>
  274.                 </xsl:choose>
  275.               </html:span>
  276.               <html:span> s</html:span>
  277.             </xsl:if>
  278.  
  279.             <xsl:if test="exif:tags/exif:fstop">
  280.               <xsl:if test="gd:rating or
  281.                             file-size or
  282.                             (gphoto:width and gphoto:height) or
  283.                             exif:tags/exif:focallength or
  284.                             exif:tags/exif:exposure">
  285.                 <html:span style="color: {$dark-foreground-color}"> – </html:span>
  286.               </xsl:if>
  287.               <html:span style="font-family: Arial;">ƒ</html:span><html:span>/</html:span>
  288.               <html:span><xsl:value-of select="round(number(exif:tags/exif:fstop/text()) * 10) div 10"/></html:span>
  289.             </xsl:if>
  290.  
  291.             <xsl:if test="exif:tags/exif:iso">
  292.               <xsl:if test="gd:rating or
  293.                             file-size or
  294.                             (gphoto:width and gphoto:height) or
  295.                             exif:tags/exif:focallength or
  296.                             exif:tags/exif:exposure or
  297.                             exif:tags/exif:fstop">
  298.                 <html:span style="color: {$dark-foreground-color}"> – </html:span>
  299.               </xsl:if>
  300.               <xul:image id="iso-image" src="{$iso-image}" height="12px"
  301.                          style="-ci-baseline-height: 1px; -ci-image-resize: scale-both;"/>
  302.               <xsl:text> </xsl:text>
  303.               <html:span><xsl:value-of select="exif:tags/exif:iso/text()"/></html:span>
  304.             </xsl:if>
  305.  
  306.             <xsl:if test="exif:tags/exif:flash/text() = 'true'">
  307.               <xsl:if test="gd:rating or
  308.                             file-size or
  309.                             (gphoto:width and gphoto:height) or
  310.                             exif:tags/exif:focallength or
  311.                             exif:tags/exif:exposure or
  312.                             exif:tags/exif:fstop or
  313.                             exif:tags/exif:iso">
  314.                 <html:span style="color: {$dark-foreground-color}"> – </html:span>
  315.               </xsl:if>
  316.               <xul:image id="flash-image" src="{$flash-on-image}" height="15px"
  317.                          alt="Flash fired"
  318.                          style="-ci-baseline-height: 3px; -ci-image-resize: scale-both"/>
  319.             </xsl:if>
  320.  
  321.             <xsl:if test="string-length(gphoto:location)">
  322.               <xsl:if test="gd:rating or
  323.                             file-size or
  324.                             (gphoto:width and gphoto:height) or
  325.                             exif:tags/exif:focallength or
  326.                             exif:tags/exif:exposure or
  327.                             exif:tags/exif:fstop or
  328.                             exif:tags/exif:iso or
  329.                             exif:tags/exif:flash/text() = 'true'">
  330.                 <html:span style="color: {$dark-foreground-color}"> – </html:span>
  331.               </xsl:if>
  332.               <html:span><xsl:value-of select="$string-location"/>: </html:span>
  333.               <html:span><xsl:value-of select="gphoto:location/text()"/></html:span>
  334.             </xsl:if>
  335.           </xul:description>
  336.  
  337.           <xul:box flex="1"/>
  338.  
  339.           <xsl:for-each select="link[@rel='explore']">
  340.             <xul:description>
  341.               <html:a>
  342.                 <xsl:attribute name="style">
  343.                   <xsl:value-of select="$underlined-link-style"/>
  344.                 </xsl:attribute>
  345.                 <xsl:attribute name="href">
  346.                   <xsl:value-of select="@href"/>
  347.                 </xsl:attribute>
  348.                 <xsl:value-of select="@title"/>
  349.               </html:a>
  350.             </xul:description>
  351.             <xul:box width="4pt"/>
  352.           </xsl:for-each>
  353.  
  354.           <xsl:apply-templates select="atom:source[atom:logo]"/>
  355.         </xul:hbox>
  356.       </xul:vbox>
  357.     </xul:stack>
  358.   </xsl:template>
  359.  
  360.  
  361.   <xsl:template match="item[@ci:state='selected']">
  362.     <xsl:call-template name="selected-window-vertical">
  363.       <xsl:with-param name="body">
  364.         <xsl:call-template name="metadata-panel"/>
  365.       </xsl:with-param>
  366.     </xsl:call-template>
  367.   </xsl:template>
  368.  
  369.  
  370.   <xsl:template match="item[@ci:state='full-screen']">
  371.     <xsl:call-template name="full-screen-window">
  372.       <xsl:with-param name="body">
  373.         <xsl:call-template name="metadata-panel"/>
  374.       </xsl:with-param>
  375.     </xsl:call-template>
  376.   </xsl:template>
  377.  
  378. </xsl:transform>
  379.